package leetcode_1001_1100;

import java.util.Arrays;

public class LeeCode_1033 {
    public static void main(String[] args) {
        System.out.println(Arrays.toString(numMovesStones(1, 2, 5)));
    }
    private static int[] numMovesStones(int a, int b, int c) {
        int min = Math.min(a, Math.min(b, c));
        int max = Math.max(a, Math.max(b, c));
        int mid = 0;
        if (a > min && a < max){
            mid = a;
        }else if (b > min && b < max){
            mid = b;
        }else {
            mid = c;
        }
        a = min;
        b = mid;
        c = max;
        int o1 = b - a - 1;
        int o2 = c - b - 1;
        if (o1 == 1 || o2 == 1){
            return new int[]{1, o1 + o2};
        }
        return new int[]{(o1 == 0 ? 0 : 1) + (o2 == 0 ? 0 : 1), o1 + o2};
    }
}
